import request from '@/utils/request'
import { remoteRequest } from '@/utils/remote'

// 查询需紧急安置人员列表
export function listUrgency(id) {
  return request({
    url: '/fxfzaqbz/data/getUrgencysettleDataByIaId/' + id,
    method: 'get',
  })
}
export function listUrgencys(id) {
  return request({
    url: '/fxfzaqbz/data/getUrgencysettleDataByActiveId/' + id,
    method: 'get',
  })
}

// 查询需紧急安置人员详细
export function getUrgency(id) {
  return request({
    url: '/fxfzaqbz/data/getUrgencysettleDataById/' + id,
    method: 'get'
  })
}

// 上传需紧急安置人员
export function uploadUrgency(data) {
  return request({
    url: '/fxfzaqbz/data/saveUrgencysettleData',
    method: 'post',
    data: data
  })
}

// 修改需紧急安置人员
export function updateUrgency(data) {
  return request({
    url: '/fxfzaqbz/data/updateUrgencysettleData',
    method: 'post',
    data: data
  })
}

// 删除需紧急安置人员
export function delUrgency(id) {
  return request({
    url: '/fxfzaqbz/data/delUrgencysettleData/' + id,
    method: 'post'
  })
}

// 生成需紧急安置人员表格
export function createUrgencyExcle(id) {
  return request({
    url: '/fxfzaqbz/data/getExcel',
    method: 'get',
    params: id,
  })
}

// 模板下载
export function downTemplate(name) {
  return request({
    url: '/fxfzaqbz/data/download?fileName=' + name,
    method: 'get',
  })
}

// 提交最终成果
export function firstSubmitDisasterAss(id) {
  return request({
    url: '/fxfzaqbz/data/submitResultUrgencysettleData?id=' + id,
    method: 'post',
  })
}

// 标题是否重复
export function titleCheck1(data) {
  return remoteRequest('titleCheck', data, () => {
    return request({
      url: '/fxfzaqbz/data/checkUrgencysettleData',
      method: 'post',
      data
    })
  })
}

// 编辑描述
export function updataDescribe(data) {
  return request({
    url: '/fxfzaqbz/data/saveDescriptionUrgencysettleData',
    method: 'post',
    data: data
  })
}

// 移除数据
export function removeDisasterAss(id) {
  return request({
    url: '/fxfzaqbz/data/removeResultUrgencysettleData?id=' + id,
    method: 'post',
  })
}

// 提交
export function secondSubmitDisasterAss(ids) {
  return request({
    url: '/fxfzaqbz/data/finalSubmissionUrgencysettleData/' + ids,
    method: 'post',
  })
}

// 是否覆盖
export function isCover(query) {
  return request({
    url: '/fxfzaqbz/data/isCheck',
    method: 'post',
    data: query,
  })
}

// 是否覆盖
export function isCoverSubmit(iaId) {
  return request({
    url: `/fxfzaqbz/data/UniquenessCheck/${iaId}`,
    method: 'get',
  })
}

// 模板下载
export function test() {
  return request({
    url: '/fxfzaqbz/DestoryRate/test',
    method: 'get',
  })
}